package com.example.morealipy.model;

import android.support.annotation.NonNull;

import java.io.Serializable;

/**
 * 应用描述
 */
public class ApplyTable implements Serializable,Comparable<ApplyTable> {
    private String name;//显示的文字，应用的名称
    private String id;
    private String type;
    private String url;//web地址
    private boolean fixed;//点击是否可以进行增删
    private int index;//控件的初始位置，可以用于判断长按是否可以拖拽
    private int imgRes;//显示的图片
    private int state = 1;//是否显示title
    //0 title 1 上面 2 下面
    private int itemType;//列表显示的类型 比如便民生活 财富管理
    private String itemTypeTitle;//列表显示类型的文本显示

    private boolean isTitle;
    private int indexType;//排序依据 当前所属集合位置

    private boolean ishidden = false;

    public boolean isIshidden() {
        return ishidden;
    }

    public void setIshidden(boolean ishidden) {
        this.ishidden = ishidden;
    }

    public boolean isTitle() {
        return isTitle;
    }

    public void setTitle(boolean title) {
        isTitle = title;
    }

    public int getIndexType() {
        return indexType;
    }

    public void setIndexType(int indexType) {
        this.indexType = indexType;
    }

    public ApplyTable() {
    }

    public ApplyTable(String name) {
        this.name = name;
    }

    public ApplyTable(String name, String id, String type, String url,
                      int index, boolean fixed, int imgRes, int state,int itemType) {
        this.name = name;
        this.id = id;
        this.type = type;
        this.url = url;
        this.fixed = fixed;
        this.index = index;
        this.imgRes = imgRes;
        this.state = state;
        this.itemType = itemType;
    }

    public boolean isFixed() {
        return fixed;
    }

    public String getItemTypeTitle() {
        return itemTypeTitle;
    }

    public void setItemTypeTitle(String itemTypeTitle) {
        this.itemTypeTitle = itemTypeTitle;
    }

    public int getItemType() {
        return itemType;
    }

    public void setItemType(int itemType) {
        this.itemType = itemType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public boolean getFixed() {
        return fixed;
    }

    public void setFixed(boolean fixed) {
        this.fixed = fixed;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public int getImgRes() {
        return imgRes;
    }

    public void setImgRes(int imgRes) {
        this.imgRes = imgRes;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    @Override
    public String toString() {
        return "ApplyTable{" +
                "name='" + name + '\'' +
                ", id='" + id + '\'' +
                ", type='" + type + '\'' +
                ", url='" + url + '\'' +
                ", fixed=" + fixed +
                ", index=" + index +
                ", imgRes=" + imgRes +
                ", state=" + state +
                '}';
    }

    //按照id排序
    @Override
    public int compareTo(@NonNull ApplyTable applyTable) {
        float i = Float.parseFloat(this.getId()) - Float.parseFloat(applyTable.getId());
        return (int) i;
    }
}
